<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>添加权限</title>
	<meta name="keywords" content="" />
    <meta name="description" content="LarryCMS Version:1.09" />
	<meta name="Author" content="larry" />
	<meta name="renderer" content="webkit">	
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">	
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">	
	<meta name="apple-mobile-web-app-capable" content="yes">	
	<meta name="format-detection" content="telephone=no">	
	<link rel="Shortcut Icon" href="/favicon.ico" />
	<!-- load css -->
	<link rel="stylesheet" type="text/css" href="/static/common/frame/layui/css/layui.css" media="all">
    <link rel="stylesheet" type="text/css" href="/static/common/css/gobal.css" media="all">
    <link rel="stylesheet" type="text/css" href="/static/css/common.css" media="all">
</head>
<body>
<div class="fadeInUp animated addata_box">
	<blockquote class="layui-elem-quote">
		1、《控/方》：意思是 控制器/方法; 例如 Sys/sysList<br/>
		2、图标名称为左侧导航栏目的图标样式，具体可查看<a href="http://www.larrycms.com/" target="_blank">LarryMS图标库</a>
	</blockquote>
	<form class="layui-form layui-form-pane">
		<div class="layui-form-item">
			<label class="layui-form-label"><em>*</em>类型</label>
			<div class="layui-input-block">
				<select name="type" lay-verify="required" lay-filter="type" >
					<option value="">请选择类型</option>
					<option value="0" {if condition="$type eq 0"}selected{/if}>管理后台</option>
					<option value="1" {if condition="$type eq 1"}selected{/if}>广告公司后台</option>
				</select>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label"><em>*</em>父级</label>
			<div class="layui-input-block">
				<select name="parent_id" lay-verify="required" lay-filter="parent_id" >
					<option value="0">默认顶级</option>
					{volist name="lists" id="vo"}
					<option value="{$vo.id}">{$vo.lefthtml}{$vo.title}</option>
					{/volist}
				</select>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label"><em>*</em>权限名称</label>
			<div class="layui-input-block">
				<input type="text" name="title" lay-verify="required" placeholder="请输入权限名称" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">控制器/方法</label>
			<div class="layui-input-block">
				<input type="text" name="href" placeholder="请输入控制器/方法" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">图标名称</label>
			<div class="layui-input-block">
				<input type="text" name="icon" placeholder="请输入图标名称" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">菜单状态</label>
			<div class="layui-input-block layui-input-7">
				<input type="radio" name="menustatus" lay-filter="menustatus" checked value="1" title="显示">
				<input type="radio" name="menustatus" lay-filter="menustatus" value="0" title="隐藏">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">排序</label>
			<div class="layui-input-block">
				<input type="text" name="sort" value="0" placeholder="请输入排序编号" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-block">
				<button type="button" class="layui-btn" lay-submit="" lay-filter="auth">立即提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>
	</form>
</div>
<!-- 加载js文件 -->
<script type="text/javascript" src="/static/common/frame/layui/layui.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script>
<script type="text/javascript">
layui.use(['form','layer','jquery'],function(){
	var $ = layui.$,
		form = layui.form,
		layer = layui.layer;
    form.on('submit(auth)', function (data) {
        // 提交到方法 默认为本身
        $.post("{:url('addData')}",data.field,function(res){
            if(res.code > 0){
                layer.msg(res.msg,{time:1000,icon:1},function(){
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index);
                    parent.location.href = res.url;
                    //location.href = res.url;
                });
            }else{
                layer.msg(res.msg,{time:1000,icon:2});
            }
        });
    });
});
</script>
</body>
</html>